home *** CD-ROM | disk | FTP | other *** search
Gui4CLI script | 1980-01-03 | 7.9 KB | 266 lines |
- G4C - CygnusEd Rexx control centre
-
- ; This is a simple program to show what you can do with the Rexx capability
- ; of Gui4Cli. You NEED the CygnusEd editor to run it.
-
- ; If CygnusEd is not already running, I look for it under the name c:ced.
- ; Look below, in order to change it to your prefered name.
-
- ; CygnusEd is a commercial product from :
- ; ASDG Inc., 925 Stewart str., Madison WI 53713, USA - Tel:(608)273-6585
-
- ; What we do is define various icons, which we use as if they were buttons
- ; and send the appropriate rexx command to rexx_ced, which is the name of
- ; CygnusEd's first Rexx port.
-
- ; CygnusEd MUST be running on a public screen (see it's preferences)
-
- ; NOTE : You need to have GUIs: assigned, so I can find the icon & gui files!
-
-
-
- WinBig -1 0 620 14 "" ; note : no title - since don't want borders
- WinType 000010 ; a borderless window with no system gadgets
- Screen CygnusEdScreen1 ; open on CED screen
- UseTopaz ; because it's a non-resizable window
-
- xOnLoad ; On Loading set the default values...
- SetVar cedClip 0
- SetVar cedMark 1
- SetVar cedSend ""
- SetVar cedFile ""
- newflag = 0
- gosub cedbar.gc StartUpCed ; See if ced is running, load it and open
- GuiLoad guis:g4c/ced/cedbar.g ; This is the program for the small bar
- GuiLoad guis:g4c/ced/cedMark.g ; This is the Mark Set/Go window
- guiload guis:tools/filereq.gc
-
- xONQuit ; On Quitting delete variables..
- delvar cedClip
- delvar cedMark
- delvar cedSend
- delvar cedFile
- GuiQuit cedbar.g ; and unload the other 2 GUIs
- GuiQuit cedmark.g
-
-
- ;*********************** Window Close & Open **************************
-
- xOnRMB ; We also close on RMB (right mouse button)
- GuiClose cedbar.gc ; You don't need this of course...
- GuiOpen cedbar.g ; I'm just showing off :)
-
- xIcon 2 0 guis:tools/icons/wnClose ; Icon for closing window
- GuiClose cedbar.gc
-
- xIcon 15 1 guis:tools/icons/right ; Icon for togling big/small windows
- GuiClose cedbar.gc
- GuiOpen cedbar.g
-
-
- ;*********************** AppMenuItem ***********************************
- ; Here, when the user selects the AppMenuItem from the WB Tools menu,
- ; we see if CygnusEd is running. If it's not, we fire it up, and then
- ; wait for its ARexx Port to appear so that we can open on it's screen.
- ; If CEd is not found, we notify the user and .. (exit stage left).
-
-
- xAppMenu GUI-Ced "" ON ; We set up an appmenu item - no need for files
- gosub cedbar.gc StartUpCed
-
-
- ;===============> This is the routine that will look for & start CygnusEd
-
- xRoutine StartUpCed
- IfExists PORT rexx_ced
- ; Don't do anything - ced is running
- else
- RUN 'c:ced' ; *** CHANGE THIS TO YOUR CED NAME ****
- Wait PORT rexx_ced 30 ; wait for ced to load
- if $$RETCODE > 0
- gosub cedbar.gc exit ; if again not found, it's hopeless!
- endif
- Wait SCREEN CygnusEdScreen1 100 ; We also wait for the Public Screen
- if $$RETCODE > 0 ; (which opens after the port)
- gosub cedbar.gc exit
- endif
- endif
- GuiClose cedbar.g ; Close the small window (just in case it was open)
- GuiOpen cedbar.gc ; Open big cedbar
- GuiScreen cedbar.gc FRONT ; and bring the screen to the front
-
-
- ;===============> this is our exit routine
-
- xRoutine exit
- ezreq "CygnusEd was not found!" EXIT ""
- GuiQuit cedbar.gc ; We quit (see xOnQuit)
- Stop ; and stop, because if we
- ; didn't, then the gosub would return to the calling
- ; event, and would continue execution. "Stop" will
- ; stop execution immediately, wherever you are.
- ; The Gui will quit on its own, after all it's
- ; commands have been executed.
-
-
-
- ;**************************** NEW/Open & next/prev Views **************
- ; From here on its a matter of declaring the icons and issuing the commands.
-
- xIcon 32 0 guis:tools/icons/New
- SendRexx rexx_ced "open new"
- gosub cedbar.gc verify
-
- xIcon 60 0 guis:tools/icons/Open
- setscreen filereq.gc CygnusEdScreen1
- newflag = 0
- *GUI = cedbar.gc
- guiopen filereq.gc
-
- xroutine LoadFile ; routine called from the FileReq.gc gui
- if $newflag = 0
- SendRexx rexx_ced "open $*FILENAME"
- newflag = 1
- else
- SendRexx rexx_ced "open new"
- SendRexx rexx_ced "open $*FILENAME"
- endif
-
- xIcon 88 0 guis:tools/icons/Big
- SendRexx rexx_ced "expand view"
- gosub cedbar.gc verify
-
- xIcon 116 0 guis:tools/icons/Up
- SendRexx rexx_ced "grow view"
- gosub cedbar.gc verify
-
- xIcon 116 8 guis:tools/icons/Down
- SendRexx rexx_ced "shrink view"
- gosub cedbar.gc verify
-
- xIcon 141 1 guis:tools/icons/left
- SendRexx rexx_ced "next view"
- gosub cedbar.gc verify
-
- xIcon 156 1 guis:tools/icons/right
- SendRexx rexx_ced "previous view"
- gosub cedbar.gc verify
-
- ;************************ CUT-COPY-PASTE / Clipboard unit *************
-
- xIcon 172 0 guis:tools/icons/cut
- SendRexx rexx_ced cut
- gosub cedbar.gc verify
-
- xIcon 200 0 guis:tools/icons/copy
- SendRexx rexx_ced copy
- gosub cedbar.gc verify
-
- xIcon 228 0 guis:tools/icons/paste
- SendRexx rexx_ced paste
- gosub cedbar.gc verify
-
- xTextIn 256 0 40 14 "" cedClip 0 5 ; This shows the number of the clipboard
- GadID 1 ; unit where your cut or copy will go.
- SetVar cedSend "set clipboard unit "
- AppVar cedSend $cedClip
- SendRexx rexx_ced $cedSend
- gosub cedbar.gc verify
-
- xIcon 296 0 guis:tools/icons/Up ; Gadgets to increase/decrease the clipboard
- counter cedClip INC 1 ; number. We use a counter to add/subtract
- if $cedClip > 255
- SetVar cedClip 0
- endif
- Update cedbar.gc 1 $cedClip
- SetVar cedSend "set clipboard unit "
- AppVar cedSend $cedClip
- SendRexx rexx_ced $cedSend
- gosub cedbar.gc verify
-
- xIcon 296 8 guis:tools/icons/Down
- counter cedClip DEC 1
- if $cedClip < 0
- SetVar cedClip 255
- endif
- Update cedbar.gc 1 $cedClip
- SetVar cedSend "set clipboard unit "
- AppVar cedSend $cedClip
- SendRexx rexx_ced $cedSend
- gosub cedbar.gc verify
-
- ;****************************** SAVE - SAVE.. - QUIT ************
-
- xIcon 320 0 guis:tools/icons/save
- SendRexx rexx_ced "save"
- gosub cedbar.gc verify
-
- xIcon 348 0 guis:tools/icons/saveas
- SendRexx rexx_ced "save as"
- gosub cedbar.gc verify
-
- xIcon 376 0 guis:tools/icons/quit
- SendRexx rexx_ced "quit"
- gosub cedbar.gc verify
-
- xIcon 404 0 guis:tools/icons/Clear
- SendRexx rexx_ced "clear"
- gosub cedbar.gc verify
-
- ;***************************** UNDO/REDO - {} - SEARCH/REPL ***********
-
- xIcon 432 0 guis:tools/icons/undo
- SendRexx rexx_ced "undo"
- gosub cedbar.gc verify
-
- xIcon 460 0 guis:tools/icons/redo
- SendRexx rexx_ced "redo"
- gosub cedbar.gc verify
-
- xIcon 488 0 guis:tools/icons/brackets
- SendRexx rexx_ced "find matching bracket"
- gosub cedbar.gc verify
-
- xIcon 516 0 guis:tools/icons/find
- SendRexx rexx_ced "search for"
- gosub cedbar.gc verify
-
- xIcon 544 1 guis:tools/icons/right
- SendRexx rexx_ced "repeat search forwards"
- gosub cedbar.gc verify
-
- xIcon 559 0 guis:tools/icons/replace
- SendRexx rexx_ced "replace"
- gosub cedbar.gc verify
-
- xIcon 587 1 guis:tools/icons/right
- SendRexx rexx_ced "repeat replace"
- gosub cedbar.gc verify
-
- ;************************** Open Mark window ************************
-
- xIcon 602 0 guis:tools/icons/link
- GuiOpen cedmark.g
-
- ;**************************** ROUTINE VERIFY ************************
- ; A little routine to let the user know if the Rexx Command failed.
-
- xRoutine Verify
- if $$Retcode > 0
- ezreq "CygnusEd was not found!" OK ""
- endif
-
- ;**************************** END of Program *************************
- ; ... and begining of advertisements :)
-
- ; I have now been using this GUI for so long that I can not imagine
- ; using CED without it. It really works nicely.
-
- ; The good thing about the above program, is that you can move the gadgets
- ; around, add or remove them and generally adgust the GUI to your liking
- ; without having to compile, recompile, swear or sweat!
-
- ; According to your monitor/resolution/font etc the Icon-buttons may be too
- ; small or too big - just redesign them to your liking.
-
-